IF OBJECT_ID (N'dbo.GetCfgCtrlKeyAsVarchar8000', N'FN') IS NOT NULL
     DROP FUNCTION dbo.GetCfgCtrlKeyAsVarchar8000
GO

CREATE FUNCTION dbo.GetCfgCtrlKeyAsVarchar8000
     ( @CfgCtrlKey varchar(30) )
RETURNS varchar(8000)
AS
/*
 *
 * GetCfgCtrlKeyAsVarchar8000
 *
 * Purpose:      
 *
 * Inputs:       
 *
 * Assumes:      
 *
 * Effects:      
 *
 * Returns:      
 *
 * Note(s):      
 *
 * Author(s):    NOVA Concepts Ltd.
 *
 * Change Log:   Initial Release, 06/15/2009, 1.00.0000
 *
 */
BEGIN
     DECLARE @ReturnValue varchar(8000)

     SELECT @ReturnValue = CfgCtrlValue
     FROM   dbo.CfgCtrl
     WHERE  CfgCtrlKey = @CfgCtrlKey

     RETURN @ReturnValue
END
GO
